﻿using System;
using System.Net;
using System.Windows;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using DDU.DataModel;

namespace DDU.ViewModel
{
    public class ActivitiesViewModel : MainViewModel
    {
        private bool showAll = false;
        public bool ShowAll
        {
            get { return showAll; }
            set
            {
                showAll = value;
                RaisePropertyChanged(() => ShowAll);
                RaisePropertyChanged(() => ItemsOfActivities);
            }
        }

        public ObservableCollection<ActivityInfo> ItemsOfActivities
        {
            get
            {
                if (ShowAll)
                {
                    return new ObservableCollection<ActivityInfo>(Database.CollectionOfActivities);
                }
                return new ObservableCollection<ActivityInfo>(Database.CollectionOfActivities.Where(a => a.EndTime > DateTime.Now));
            }
        }
    }
}
